import React from "react";
import './index.css';
import CouponCard from "../../../Component/CouponCard";
import { SearchOutlined } from '@ant-design/icons';
import { Input } from 'antd';
import QualityServer from "../../../Server/Trade/QualityServer";
import URL from "../../../Server/URL";
const { Search } = Input;

export default class extends React.Component{
    
    constructor(props){
        super();
        this.state={
            goods:[],
        }
        this.Gen();
    }
    Gen(){
        QualityServer.ShopFlySuperiorShopLsit(1)
        .then(res=>{
            let goods=[];
            // console.log(res)
            res.data.forEach(i => {
                let superior=i.sFlySuperior;
                let coupon=i.coupon;

                let title=superior.title;
                let desc=coupon.instructions;
                let price=superior.price;
                let pic=URL.GetURL(superior.img);
                
                goods.push(
                    <a href={"/trade/qualityDetail/"+superior.id} key={superior.couponId} alt="quality">
                        <CouponCard
                        cover={<img alt="drone" src={pic}/>}
                        title={title}
                        description={desc}
                        priceText={price}/>
                    </a>
                )
            });
            this.setState({
                goods
            })
        });
    }
    render(){
        return(
            <div>
                <div className="Hot_Right">
                        <div className="Hot_Page_Top">
                            <div className="Hot_Search">
                                <Search
                                    prefix={<SearchOutlined />}
                                    placeholder="搜索"
                                    enterButton="搜索"
                                    size="large"
                                    onSearch={value =>this.Search(value)}
                                    onChange={e=>this.setState({searchContent:e.target.value})}
                                    />
                            </div>
                        </div>
                    </div>
                <div className="">
                    {this.state.goods}
                </div>
            </div>
        )
    }
}